﻿using System.Collections.Generic;
using System.Linq;
using NetSurveillance.WebApp.DataServices.Models;
using NetSurveillance.WebApp.Foundations;

namespace NetSurveillance.WebApp.Utilities
{
    public static class ViewUtility
    {
         public static bool IsAuthenticated()
         {
             var currentUser = PersistentDataContainer.Current.Read<User>(PresetValues.SessionKeys.CurrentUser);
             return currentUser != null;
         }

         public static bool InDisplayFields(ICollection<string> displayFields, string propertyName)
         {
             return displayFields == null || !displayFields.Any() || displayFields.Contains(propertyName);
         }
    }
}